package com.zbfmq.xonfig;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/3/11  13:22
 * 描述:
 */

@Configuration
public class RabitMQConfig3 {

    @Bean("queue5")
    public Queue getQueue(){
        Queue queue = new Queue("test-queue", false, false, true);
        return queue;
    }

    @Bean("testExchange")
    public Exchange getDeadExchange(){
        Exchange build = ExchangeBuilder.directExchange("test-exhange").durable(false).autoDelete().build();
        return build;
    }

    @Bean("binding6")
    public Binding getHeaderBinding(@Qualifier("queue5") Queue queue, @Qualifier("testExchange") Exchange exchange){

        Binding binding = BindingBuilder.bind(queue).to(exchange).with("test-key").noargs();

        return binding;
    }

}
